new Vue({
    el:'#main',
    data:()=>({
        montharr:[],//月份
        selmonth:{},//被选中的月份
        Willbe:[],//添加采购计划
        search:'',//查找公司
        searchText:"",//添加采购计划的搜索内容
        company:[],//公司
        port:[],//交货地址
        packing:[],//装箱清单
        plan:[],//订单
        linkman:[],//联系人
        bank:[],//银行
        planInfo:{},
        conpanyinfo:{//公司详细资料
            addr: "",
            create_name: "",
            create_time: "",
            id: '',
            name: "",
            nickname: "",
            status: "",
            zipcode: ""
        },
        terms:{
            general_terms:{
                id:'',
                content:''
            },
            delivery_terms:{
                id:'',
                content:''
            },
            payment_terms:{
                id:'',
                content:''
            },
            after_sales_terms:{
                id:'',
                content:''
            }
        },//合同条款
        showpay:false,
        paypoarr:[],
        cost_list:[],
        commonly:['产品运费','入仓费用','包装材料费用','坏品抵扣货款'],//常用选项
        addother:{
            selcontent:'0',
            remarks:'',//支出收入内容
            In_and_out:"",//支出or收入
            amount:0,//金额
            apportion:false,//是否分摊到成本
            is_replace_pay:false//是否代付
        },
        onwpayplan:{
            pay_day:'',//时间
            amount:'',//金额
            percent:'',//百分比
            is_edit:false,
            index:0
        },
        onwpackingStatus:'add',
        onwpacking:{
            content:'k',//选择内容
            boxnum:1,//箱数
            num:0,//数量
            size:'',//尺寸
            witch:0,//重量
            volume:0,//体积
            note:'',//备注
            ischeck:'',//是否更新到合同明细
        },
        data:{
            delivery_day:'',//交货时间
            port_id:0,//交货地址
            linkman_id:0,//选中的联系人
            company_id:0,//选中的公司
            price_sum:0,//合计金额  合同合计  
            bank_id:0,//银行账户id
            qty_sum:0,//合计箱数
            m3_sum:0,//合计体积
            kgs_sum:0,//合计重量
            has_sum:0,//已付金额
            replace_sum:0,//代付合计
            paid_sum:0,//已付合计
            cost_sum:0,//应付合计
            country_id:0,
            sign_day:0,
            create_at:0
        },
        sumbox:{//装箱清单合计
            pro_num:0,//产品个数
            boxnum:0,//箱数
            volume:0,//体积
            witch:0,//重量
        },
        buy_po_logs:[],
        ids:[],
        po_id:'',
        clickTerms:[],
        termsType:'general_terms',
    }),
    methods:{
        formatUnit:formatUnit,
        getdata(){
            $.ajax({
                url:'/admin/buy/plan2po?request='+$('.ntDesktop-head').attr('type'),
                type:'post',
                data:{plan_ids:this.$refs.plan_ids.value,po_id:$('#po_id').val()},
                success:(data)=>{
                    data = JSON.parse(data)
                    this.setPort_idAndCompany_id(data)
                    //this.paypoarr=JSON.parse(JSON.stringify(data.paypoarr))
                    for (const key in data) {
                        if (this.hasOwnProperty(key)) {
                            this[key]=JSON.parse(JSON.stringify(data[key]))
                        }
                    }
                    
                    if($('.ntDesktop-head').attr('type')=='edit'){
                        for (const key in data.buy_po) {
                            if (this.data.hasOwnProperty(key)) {
                                this.data[key]=data.buy_po[key]
                            }
                        }
                        this.po_id=data.buy_po.id
                    }
                    console.log(this.terms)
                    this.data.replace_sum = this.data.cost_sum
                    this.calculate()
                    this.monnysum()
                    // this.cptdother()//计算代付金额 
                    this.comnum()
                    $('.loding').hide()
                }
            })
        },
        setPort_idAndCompany_id(data){
            // console.log(this.data)
            var isPort_id = false
            var port_id = 0
            var iscompany_id = false
            var company_id = 0
            var isdelivery_day = false
            var delivery_day = 0
            for (var i = 0; i < data.plan.length; i++) {
                // 是否默认码头
                if(i == 0){
                    port_id = data.plan[i].port_id
                    isPort_id = true
                }else if(data.plan[i].port_id == port_id){
                    isPort_id = true
                }else if(data.plan[i].port_id != port_id){
                    isPort_id = false
                }

                // 是否默认公司
                if(i == 0){
                    company_id = data.plan[i].company_id
                    iscompany_id = true
                }else if(data.plan[i].company_id == company_id){
                    iscompany_id = true
                }else if(data.plan[i].company_id != company_id){
                    iscompany_id = false
                }

                // 是否默认送货时间
                if(i == 0){
                    delivery_day = data.plan[i].delivery_at
                    isdelivery_day = true
                }else if(data.plan[i].delivery_at == delivery_day){
                    isdelivery_day = true
                }else if(data.plan[i].delivery_at != delivery_day){
                    isdelivery_day = false
                }

            }
            if(isPort_id) this.data.port_id = port_id
            if(iscompany_id){
                this.data.company_id = company_id
                this.changecompany()
            } 
            if(delivery_day) this.data.delivery_day = delivery_day


            
        },
        getplan(data){
            if(data){
                this.selmonth=data
            }
            $.ajax({
                url:'/admin/buy/plan',
                type:'post',
                data:{
                   item:0,
                   year:this.selmonth.year,
                   month:this.selmonth.month,
                   searchText:this.searchText,
                   plan_ids:this.plan.map(element=>{
                            return element.id
                    }).join(',')
                },
                success:(data)=>{
                    data = JSON.parse(data)
                    this.Willbe=data.data.plan
                }
            })
        },
        calculate(){//计算
            this.data.price_sum=0
            this.data.qty_sum=0
            this.data.m3_sum=0
            this.data.kgs_sum=0
            this.ids=[]
            this.plan.forEach(element => {
                this.ids.push(element.id)
                this.data.price_sum+=element.price_sum-0 //获取总价格
                this.data.qty_sum+=element.qty-0 //获取总箱数
                this.data.m3_sum+=element.m3_sum-0 //获取总体积
                this.data.kgs_sum+=element.kgs_sum-0 //获取总体积
            });
        },
        changecompany(){
            $.ajax({
                url:'/admin/buyapi/getCompanyLinkman',
                type:'post',
                data:{
                    id:this.data.company_id
                },
                success:(data)=>{
                    data = JSON.parse(data)
                    this.data.country_id=data.country_id
                    this.linkman=data.linkman
                    this.bank=data.bank
                    if(this.linkman.length==1){
                        this.data.linkman_id=this.linkman[0].id
                    }else{
                        this.linkman.forEach(element=>{
                            if(element.is_main)
                            this.data.linkman_id=element.id
                        })
                    }
                    if(this.bank.length==1){
                        this.data.bank_id=this.bank[0].id
                    }else{
                        this.bank.forEach(element=>{
                            if(element.is_main){
                               this.data.bank_id=element.id 
                            }
                        })
                    }
                }
            })
        },
        monnysum(){
            this.data.has_sum=0
            this.paypoarr.forEach(element => {
                this.data.has_sum+=element.amount
            });
        },
        payplan(plan){ //生成付款安排
            if(plan==1){
                var pay_day=new Date()
                this.paypoarr=[
                    {
                        pay_day:pay_day.getFullYear()+'-'+(pay_day.getMonth()+1)+'-'+(pay_day.getDate()+1),
                        amount:this.data.price_sum*0.3,
                        percent:30,
                    },
                    {
                        pay_day:this.$refs.jhdate.value,
                        amount:Math.round(this.data.price_sum*0.7*100)/100,
                        percent:70,
                    }
                ]
            }else if(plan==2){
                this.paypoarr=[
                    {
                        pay_day:this.$refs.jhdate.value,
                        amount:Math.floor(this.data.price_sum*100)/100,
                        percent:100,
                    }
                ]
            }
            this.monnysum()
        },
        cahngehalf(val){ //改变百分比
            this.onwpayplan.percent=val
            this.onwpayplan.amount=Math.floor(this.data.price_sum*this.onwpayplan.percent/100*100)/100
        },
        changemn(){  //改变金额
            this.onwpayplan.percent=Math.floor(this.onwpayplan.amount/this.data.price_sum*100*100)/100
        },
        remafun(){  //剩余金额
            var num=this.data.price_sum
            this.paypoarr.forEach(element => {
                num-=element.amount
            });
            this.onwpayplan.amount=num
            this.changemn()
        },
        savepay(){
            if(this.onwpayplan.amount!=''&&this.onwpayplan.percent.toString()!=''){//判断是否有数据
                var consum=0//已经添加的金额
                this.paypoarr.forEach((element,index) => {
                    if(index!=this.onwpayplan.index){
                        consum+=element.amount
                    }
                });
                consum=this.onwpayplan.amount-0+consum
                if(consum<=this.data.price_sum){ //如果金额大于总金额提示
                   this.onwpayplan.pay_time=this.$refs.fkdate.value
                    if(this.onwpayplan.pay_time!=''){//时间选择提示
                        if( Math.floor((new Date(this.onwpayplan.pay_time).getTime())/1000) < this.data.create_at){
                            change_mes_type('.payment .alert',2)
                            $('.payment .alert').show()
                            $('.payment .alert p').html('*选择当天或当前之后的付款日期')
                            return false
                        }

                        if(this.onwpayplan.is_edit){
                            for (const key in this.onwpayplan) {
                                if (this.paypoarr[this.onwpayplan.index].hasOwnProperty(key)) {
                                    this.paypoarr[this.onwpayplan.index][key]=this.onwpayplan[key]
                                }
                            }
                        }else{
                            this.paypoarr.push(this.onwpayplan)
                        }
                        this.data.has_sum=consum
                        $('#pay_Modal').modal('hide') 
                    }else{
                        console.log(123)
                        change_mes_type('.payment .alert',2)
                        $('.payment .alert').show()
                        $('.payment .alert p').html('*'+$('#msg-time').val())
                    }
                }else{
                    change_mes_type('.payment .alert',2)
                    $('.payment .alert').show()
                    $('.payment .alert p').html('*'+$('#msg-monny').val())
                }
            }else{
                change_mes_type('.payment .alert',2)
                $('.payment .alert').show()
                $('.payment .alert p').html('*'+$('#msg-amount').val())
            }
        },
        getcominfo(){   //获取公司详细资料
            $.ajax({
                url:'/admin/buyapi/getCompanyInfo',
                type:'post',
                data:{id:this.data.company_id},
                success:(data)=>{
                    data = JSON.parse(data)
                    if(data.status ==1){
                        for (const key in data.data) {
                            if (this.conpanyinfo.hasOwnProperty(key)) {
                                this.conpanyinfo[key]=data.data[key]
                            }
                        }+10
                        $('#co_detailModal').modal('show')
                    } 
                }
            })
        },
        delplan(index,id){
            this.plan.splice(index,1)
            this.calculate()
        },
        //提交数据
        savefun(){
            for (var i = 0; i < this.plan.length; i++) {
                if(this.plan[i].price <= 0) {
                    change_mes_type('.mainmsg .alert',2)
                    $('.mainmsg .alert').show()
                    $('.mainmsg .alert p').html('采购清单中计划订单号：'+this.formatUnit(this.plan[i].id,'id')+' 采购价格小于/等于0，不能生成采购合同')
                    return false
                }
            }
            this.data.delivery_day=this.$refs.jhdate.value
            var data={
                data:this.data,
                ids:this.ids,
                terms:this.terms,
                paypoarr:this.paypoarr,
                po_id:this.po_id,
                cost_list:this.cost_list,
                packing:this.packing
            }
            if($('.ntDesktop-head').attr('type') == 'add'){
                var url = '/admin/buypo/addBuyPo';
            }else{
                var url = '/admin/buypo/editBuyPo?request=update';
            }
            $.ajax({
                url:url,
                type:'post',
                data,
                success:(data)=>{
                    data = JSON.parse(data)
                    change_mes_type('.mainmsg .alert',data.status)
                    $('.mainmsg .alert').show()
                    $('.mainmsg .alert p').html(data.msg)
                    if(data.status==1){
                        window.history.go(-1)
                    }
                }
            })
        },
        changeplan(index){
            this.planInfo = JSON.parse(JSON.stringify(this.plan[index]))
        },
        delpay(index){//删除付款安排
            this.paypoarr.splice(index,1)
            this.monnysum()
        },
        openmodel(is_edit,index){//打开 添加或修改付款安排弹框
            this.onwpayplan={
                pay_day:'',
                amount:'',
                percent:''
            }
            if(is_edit){
               this.onwpayplan= JSON.parse(JSON.stringify(this.paypoarr[index]))
                this.onwpayplan.is_edit=is_edit
                this.onwpayplan.index=index
            }
            this.$refs.fkdate.value=this.onwpayplan.pay_day
            $('.form_datetime').datetimepicker('update');
            $('#pay_Modal').modal('show')
        },
        editsavefun(){//提交采购计划编辑数据

            var data = {
                id:this.planInfo.id,
                is_item:this.planInfo.is_item,
                po_id:this.planInfo.po_id,
                pro_id:this.planInfo.pro_id,
                prochar_id:this.planInfo.prochar_id,
                buy_id:this.planInfo.buy_id,
                qty:this.planInfo.qty,
                price:this.planInfo.price,
                delivery_at:this.planInfo.delivery_at,
                port_id:this.planInfo.port_id,
                ctn_qty:this.planInfo.ctn_qty,
            }
            console.log(data)
            $.ajax({
                url:'/admin/buy/plan_editnew?request=update',
                type:'post',
                data:{data:data,id:this.planInfo.id},
                success:(data)=>{
                    data = JSON.parse(data)
                    console.log(data)
                    if(data.status==1){
                        change_mes_type('.mainmsg .alert',data.status)
                        $('.mainmsg .alert').show()
                        $('.mainmsg .alert p').html(data.msg)
                        this.plan=this.plan.map(element=>{
                            if(element.id==this.planInfo.id)
                            element=this.planInfo
                            return element
                        })
                        this.calculate()
                        this.$nextTick(function(){
                            this.monnysum()
                        })
                        $('#plan_detailModal').modal('hide') 
                    }
                }   
            })
        },
        addplan(index){//加入采购计划
            if(this.Willbe[index].price <= 0){
                change_mes_type('.payment .alert',2)
                $('.payment .alert').show()
                $('.payment .alert p').html('加入的采购计划采购单价不能为零')
                return false
            }
            if(this.Willbe[index].qty <= 0){
                change_mes_type('.payment .alert',2)
                $('.payment .alert').show()
                $('.payment .alert p').html('加入的采购计划采购数量不能为零')
                return false
            }

            if(this.plan.every(element=>{
                if(element.prochar_id == this.Willbe[index].prochar_id){
                    change_mes_type('.payment .alert',2)
                    $('.payment .alert').show()
                    $('.payment .alert p').html('当前合同已存在该产品，不能重复选择')
                }
                return element.prochar_id != this.Willbe[index].prochar_id
            })){
                planInfo=this.Willbe[index]
                planInfo.po_id = $('#po_id').val();
                $.ajax({
                    url:'/admin/buy/addBuyPoToPlan?request=update',
                    type:'post',
                    data:this.Willbe[index],
                    data:{planInfo:this.Willbe[index],id:this.Willbe[index].id},
                    success:(data)=>{
                        data = JSON.parse(data)
                        change_mes_type('.payment .alert',data.status)
                        if(data.status==1){
                            this.plan.push(this.Willbe[index])
                            this.calculate()
                            this.$nextTick(function(){
                                this.monnysum()
                            }) 
                            console.log(this.Willbe[index])
                            $('.payment .alert').show()
                            $('.payment .alert p').html("产品："+this.Willbe[index].pro_name+',型号：'+this.Willbe[index].model+'加入成功')
                        }
                    }   
                })
            }
        },
        changeinfo(){
            if( $("#planInfoQty").val() <= 0){
                change_mes_type('#plan_detailModal .alert',2)
                $('#plan_detailModal .alert').show()
                $('#plan_detailModal .alert p').html('采购数量不能为0,原采购数量：'+this.planInfo.qty)
                $('#editsavefun').attr('disabled',true)
                return false
            } 
            if($("#planInfoPrice").val() <= 0){
                change_mes_type('#payment .alert',2)
                $('#plan_detailModal .alert').show()
                $('#plan_detailModal .alert p').html('采购单价不能为0,原采购价：'+this.planInfo.price)
                $('#editsavefun').attr('disabled',true)
                return false
            } 
            this.planInfo.qty = $("#planInfoQty").val()
            this.planInfo.price = $("#planInfoPrice").val()
            this.planInfo.qty_sum=this.planInfo.ctn_qty * this.planInfo.qty
            this.planInfo.price_sum=this.planInfo.price * this.planInfo.qty_sum
            $('#editsavefun').attr('disabled',false)
        },
        delother(index){
            this.cost_list.splice(index,1)
            this.cptdother()//计算代付金额   
        },
        saveother(){

            var data = JSON.parse(JSON.stringify(this.addother));
            if(data.amount > 0)
                if(data.In_and_out != 1) data.amount = data.amount - data.amount*2

            if(this.addother.edit){
                this.cost_list[this.addother.edit.index]=data
                this.cptdother()//计算代付金额   
                $('#cost_Modal').modal('hide') 
            }else{
                // console.log(this.addother)
                this.cost_list.push(data)
                this.cptdother()//计算代付金额   
                $('#cost_Modal').modal('hide') 
            }
        },
        cptdother(){
            this.data.replace_sum=0
            this.cost_list.forEach(element => {
                
                if(element.amount > 0){
                    element.In_and_out = '1'
                }else{
                    element.In_and_out = '0'
                }

                if( element.In_and_out=="1" ){  // 收入
                      this.data.replace_sum += Math.abs(element.amount)
                }
                if(element.is_replace_pay && element.In_and_out=="0"  ){    // 支出 && 代付
                      this.data.replace_sum -= Math.abs(element.amount)
                }
            });

            this.changePaypoarr()
            
        },
        // 改变付款安排百分比额度
        changePaypoarr(){
            var sum = this.data.price_sum+this.data.replace_sum
            // console.log(this.paypoarr)
            this.paypoarr.forEach(element => {
                element.amount = Math.floor( (sum*(element.percent/100)),2 )
            })
        },
        saveboxcon(){
            this.onwpacking.container_name='-'
            if(this.onwpackingStatus == 'add'){
                this.packing.push(
                    Object.assign({},this.onwpacking,this.plan[this.onwpacking.content])
                ) 
            }
            if(this.onwpackingStatus == 'edit'){
                this.packing[this.onwpacking.content] = Object.assign({},this.onwpacking,this.plan[this.onwpacking.content])
            }
            this.onwpacking={
                content:'k',//选择内容
                boxnum:0,//箱数
                num:0,//数量
                size:'',//尺寸
                witch:0,//重量
                volume:0,//体积
                note:'',//备注
                ischeck:'',//是否更新到合同明细
                
            }
            this.comnum()
        },
        comnum(){
            this.sumbox={
                pro_num:0,//产品个数
                boxnum:0,//箱数
                volume:0,//体积
                witch:0,//重量
            }
            
            this.packing.forEach(item=>{
                if(item.content!='k'){
                    this.sumbox.pro_num++
                    this.sumbox.boxnum+=(item.num-0)
                    this.sumbox.witch+=(item.witch-0)
                    this.sumbox.volume+=(item.volume-0)
                }
            })
        },
        getcompany(){
            $.ajax({
                url:'/admin/buyapi/searchCompany',
                type:'post',
                data:{searchCompany:this.search},
                success:(data)=>{
                    data = JSON.parse(data)
                    this.company=data
                    this.data.company_id=0
                    if(this.company.length==1){
                        this.data.company_id=this.company[0].id
                        this.changecompany()
                    }
                }   
            })
        },
        changepack(){
            this.onwpacking.boxnum=this.packing[this.onwpacking.content].boxnum
            this.onwpacking.num=this.packing[this.onwpacking.content].num
            this.onwpacking.size=this.packing[this.onwpacking.content].size
            this.onwpacking.witch=this.packing[this.onwpacking.content].witch
            this.onwpacking.volume=this.packing[this.onwpacking.content].volume
            this.onwpacking.note=this.packing[this.onwpacking.content].note
        },
        boxing_content_added(){
            this.onwpackingStatus = 'add'
        },
        editzxqd(index){
            this.onwpacking.content = index
            this.changepack()
            this.onwpackingStatus = 'edit'
            $('#onwpackingId').attr("disabled", "disabled");
        },
        delzxqd(index){
            this.packing.splice(index,1)
        },
        editother(index){//编辑其他费用
            if(this.cost_list[index].amount > 0){
                this.cost_list[index].In_and_out = '1'
            }else{
                this.cost_list[index].In_and_out = '0'
            }
            this.cost_list[index].selcontent = this.cost_list[index].remarks
            this.addother=this.cost_list[index]
            this.addother.edit={index:index,is_edit:true}
        },
        clickTermsFun(type='get',termsType='',index=''){
            $('#terms_editModal .alert').hide()
            if(termsType == ''){
                termsType = this.termsType
            } else{
                this.termsType = termsType
            }
            if(type == 'get'){
                $.ajax({
                    url:'/admin/buy/clickTerms?requestType='+type+"&termsType="+termsType,
                    type:'post',
                    success:(data)=>{
                        data = JSON.parse(data)
                        this.clickTerms = data
                    }
                })    
            }else{
                if(this.terms[termsType].content.indexOf(this.clickTerms[index].content) != -1){
                    change_mes_type('#terms_editModal .alert',2)
                    $('#terms_editModal .alert').show()
                    $('#terms_editModal .alert p').html('选中合同条款已存在')
                    return false
                }else{
                    $('#terms_editModal .alert').hide()
                    this.terms[termsType].id += this.terms[termsType].id ? ','+this.clickTerms[index].id : this.clickTerms[index].id
                    this.terms[termsType].content += this.terms[termsType].content ? "\n-"+this.clickTerms[index].content : '-'+this.clickTerms[index].content
                    change_mes_type('#terms_editModal .alert',1)
                    $('#terms_editModal .alert').show()
                    $('#terms_editModal .alert p').html('条款内容：'+this.clickTerms[index].content+"<br/>添加成功。")
                }
            }
        },
        backToList(){
            if($('.ntDesktop-head').attr('type')=='edit'){
                var url = '/admin/Buypo/list'
            }else{
                var url = '/admin/buy/plan'
            } 
            window.location.href = url
        }
    },
    mounted(){
        $('.loding').show()
        this.getdata()
        var pay_day=new Date()
        var newyear=pay_day.getFullYear(),month=pay_day.getMonth()
        if(month+2==13){
            newyear+=1
            month=1
        }else{
            month+=2
        }
        this.data.delivery_day=newyear+'-'+month+'-'+pay_day.getDate()
        $('#plan_addModal').on('show.bs.modal', (e)=> {
            this.getplan(this.montharr[0])
        })
        //关闭添加或编辑联系人刷新数据
        $('#linkman_Modal').on('hide.bs.modal', (e)=> {
            this.changecompany()
        })
        //银行账号刷新
        $('#bank_Modal').on('hide.bs.modal', (e)=> {
            this.changecompany()
        })
        $("#cost_Modal").on("hidden.bs.modal",()=>{ 
            this.addother={
                selcontent:'0',
                remarks:'',//支出收入内容
                In_and_out:"1",//支出or收入
                amount:'',//金额
                cost:false,//是否分摊到成本
                is_replace_pay:false//是否代付
            }
        });
        $("#pay_Modal").on("hidden.bs.modal", function () {
            $(this).removeData("bs.modal");
            $('.payment .alert').hide()
            $('.payment .alert p').html('')
        });
        $('.form_datetime').on('changeDate', (e)=>{
            this.onwpayplan.pay_day=this.$refs.fkdate.value
            this.data.delivery_day=this.$refs.jhdate.value
        });
        var year=new Date().getFullYear()
        var current=new Date().getMonth()+1
        this.year=year
        this.month=current
        this.montharr.push({year:year,month:current})
        for(var i=1;i<=6;i++){
            current++
            if(current>12){
                year++
                current=1
            }
            this.montharr.push({year:year,month:current})
        }
        this.data.create_at == 0 ? Math.floor((new Date().getTime())/1000)  : this.data.create_at

    },
    watch:{
        'data.price_sum':function(){
            if(this.paypoarr.length){
                this.paypoarr.map((element)=>{
                if(element.percent != '-')
                    element.amount=this.data.price_sum*element.percent/100
                })
            }
        },
        'addother.In_and_out':function(){
            /* if(this.addother.In_and_out-0){
                this.addother.amount=-Math.abs(this.addother.amount)
            }else{
                this.addother.amount=Math.abs(this.addother.amount)
            } */
        },
        'addother.amount':function(){
            /* if(this.addother.In_and_out-0){
                this.addother.amount=+this.addother.amount
            }else{
                this.addother.amount=-Math.abs(this.addother.amount)
            } */
        }
    }
})
$("#linkman_Modal").on("hidden.bs.modal", function () {
    $(this).removeData("bs.modal");
});
$("#bank_Modal").on("hidden.bs.modal", function () {
    $(this).removeData("bs.modal");
});